package ru.tulupov.collectionsbenchmark.test;

import ru.tulupov.collectionsbenchmark.Test;
import ru.tulupov.collectionsbenchmark.model.Car;
import ru.tulupov.collectionsbenchmark.model.CarHeightComparator;
import ru.tulupov.collectionsbenchmark.model.CarWidthComparator;
import ru.tulupov.collectionsbenchmark.tester.ArrayListTester;
import ru.tulupov.collectionsbenchmark.tester.HashSetTester;
import ru.tulupov.collectionsbenchmark.tester.LinkedListTester;
import ru.tulupov.collectionsbenchmark.tester.ListTester;
import ru.tulupov.collectionsbenchmark.tester.Tester;
import ru.tulupov.collectionsbenchmark.tester.TreeSetTester;

@Test(name = "Random access to list")
public class RandomAccessTestSuite extends AbstractTest {
	private static final int COUNT = 10000;
	
	private Tester<Car> arrayListTester;
	private Tester<Car> linkedListTester;
	private Tester<Car> hashSetTester;
	private Tester<Car> treeSetTester;

	public RandomAccessTestSuite() {
		this.arrayListTester = new ArrayListTester<Car>();
		this.linkedListTester = new LinkedListTester<Car>();
		this.hashSetTester = new HashSetTester<Car>();
		this.treeSetTester = new TreeSetTester<Car>();
		 
		arrayListTester.init(cars);
		linkedListTester.init(cars);
		hashSetTester.init(cars);
		treeSetTester.init(cars);
	}

	@Test(count = COUNT)
	public void arrayListTest() {
		arrayListTester.randomAccess(COUNT);
	}

	@Test(count = COUNT)
	public void linkedListTest() {
		linkedListTester.randomAccess(COUNT);
	}
	@Test(count = COUNT)
	public void hashSetTest() {
		hashSetTester.randomAccess(COUNT);
	}

	@Test(count = COUNT)
	public void treeSetTest() {
		treeSetTester.randomAccess(COUNT);
	}

}
